<?php

use Illuminate\Database\Seeder;

class InitBasicDataSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //管理员
        $admins = [
            ['name' => 'Admin', 'account' => 'admin', 'mobile' => '15915750212', 'email' => 'admin@126.com'],
            ['name' => '张三', 'account' => 'zhangsan', 'mobile' => '15915750213', 'email' => 'cs09bmeek@126.com'],
            ['name' => '李四', 'account' => 'lisi', 'mobile' => '15915750214', 'email' => 'cs09bmeek@163.com'],
        ];

        foreach ($admins as $admin) {
            factory(App\Http\Models\Admin\Admin::class, 1)->create($admin);
        }

        //应用信息
        $apps = [
            ['name' => '运营后台', 'host' => 'admin.gdyylr.com', 'desc' => '统一管理后台', 'status' => 1],
            ['name' => '数据平台', 'host' => 'data.gdyylr.com', 'desc' => '数据平台', 'status' => 1],
        ];

        foreach ($apps as $app) {
            factory(App\Http\Models\App\App::class, 1)->create($app);
        }

        //应用组信息
        $apps_groups = [
            ['name' => '管理员', 'app_id' => 1],
            ['name' => '技术部', 'app_id' => 1],
            ['name' => '大修厂', 'app_id' => 1],
            ['name' => '加油站', 'app_id' => 1],
            ['name' => '售票', 'app_id' => 1],
            ['name' => '驾培', 'app_id' => 1],
            ['name' => '管理员', 'app_id' => 2],
            ['name' => '高级领导', 'app_id' => 2],
            ['name' => '部门经理', 'app_id' => 2],
            ['name' => '技术部', 'app_id' => 2],
            ['name' => '运营部', 'app_id' => 2],
            ['name' => '财务部', 'app_id' => 2],
            ['name' => '微信开发', 'app_id' => 1],
        ];

        foreach ($apps_groups as $app_group) {
            factory(App\Http\Models\App\AppGroup::class, 1)->create($app_group);
        }

        //应用权限
        $apps_auths = [
            ['parent_id' => 0, 'app_id' => 1, 'name' => '会员模块', 'uri' => '', 'css' => 'icon-user'],
            ['parent_id' => 1, 'app_id' => 1, 'name' => '用户管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 2, 'app_id' => 1, 'name' => '标签信息', 'uri' => 'user.tag.tag', 'css' => 'icon-tag'],
            ['parent_id' => 2, 'app_id' => 1, 'name' => '新增标签', 'uri' => 'user.tag.add', 'css' => 'icon-tag_blue_add'],
            ['parent_id' => 2, 'app_id' => 1, 'name' => '用户列表', 'uri' => 'user.user.user', 'css' => 'icon-report_user'],
            ['parent_id' => 2, 'app_id' => 1, 'name' => '新增用户', 'uri' => 'user.user.add', 'css' => 'icon-user_add'],
            ['parent_id' => 1, 'app_id' => 1, 'name' => '车辆信息', 'uri' => '', 'css' => ''],
            ['parent_id' => 7, 'app_id' => 1, 'name' => '车辆列表', 'uri' => '', 'css' => 'icon-car_red'],
            ['parent_id' => 7, 'app_id' => 1, 'name' => '新增车辆', 'uri' => '', 'css' => 'icon-car_add'],
            ['parent_id' => 7, 'app_id' => 1, 'name' => '维修记录', 'uri' => '', 'css' => 'icon-bullet_wrench_red'],
            ['parent_id' => 1, 'app_id' => 1, 'name' => '消费信息', 'uri' => '', 'css' => ''],
            ['parent_id' => 11, 'app_id' => 1, 'name' => '消费列表', 'uri' => '', 'css' => 'icon-cart'],
            ['parent_id' => 1, 'app_id' => 1, 'name' => '积分信息', 'uri' => '', 'css' => ''],
            ['parent_id' => 13, 'app_id' => 1, 'name' => '积分列表', 'uri' => '', 'css' => 'icon-rosette_blue'],
            ['parent_id' => 1, 'app_id' => 1, 'name' => '反馈信息', 'uri' => '', 'css' => ''],
            ['parent_id' => 15, 'app_id' => 1, 'name' => '反馈列表', 'uri' => '', 'css' => '_comment'],
            ['parent_id' => 0, 'app_id' => 1, 'name' => '大修厂模块', 'uri' => '', 'css' => 'icon-hammer_screwdriver'],
            ['parent_id' => 17, 'app_id' => 1, 'name' => '配件管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 18, 'app_id' => 1, 'name' => '配件查找', 'uri' => '', 'css' => 'icon-search'],
            ['parent_id' => 18, 'app_id' => 1, 'name' => '配件入库', 'uri' => '', 'css' => 'icon-plus'],
            ['parent_id' => 17, 'app_id' => 1, 'name' => '工单管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 21, 'app_id' => 1, 'name' => '生成工单', 'uri' => '', 'css' => 'icon-plus'],
            ['parent_id' => 21, 'app_id' => 1, 'name' => '工单修改', 'uri' => '', 'css' => 'icon-edit'],
            ['parent_id' => 0, 'app_id' => 1, 'name' => '加油站模块', 'uri' => '', 'css' => 'icon-rainbow'],
            ['parent_id' => 24, 'app_id' => 1, 'name' => '订单管理', 'uri' => '', 'css' => 'icon-list'],
            ['parent_id' => 25, 'app_id' => 1, 'name' => '订单查询', 'uri' => '', 'css' => 'icon-search'],
            ['parent_id' => 24, 'app_id' => 1, 'name' => '油品管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 27, 'app_id' => 1, 'name' => '油品价格', 'uri' => '', 'css' => ''],
            ['parent_id' => 24, 'app_id' => 1, 'name' => '油枪管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 29, 'app_id' => 1, 'name' => '油枪关联', 'uri' => '', 'css' => ''],
            ['parent_id' => 24, 'app_id' => 1, 'name' => '加油卡管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 31, 'app_id' => 1, 'name' => '油卡查询', 'uri' => '', 'css' => 'icon-ticket'],
            ['parent_id' => 31, 'app_id' => 1, 'name' => '油卡新增', 'uri' => '', 'css' => 'icon-ticket'],
            //
            ['parent_id' => 0, 'app_id' => 2, 'name' => '票务数据', 'uri' => '', 'css' => 'glyphicon-tags'],
            ['parent_id' => 34, 'app_id' => 2, 'name' => '购票分布', 'uri' => '', 'css' => 'glyphicon-send'],
            ['parent_id' => 34, 'app_id' => 2, 'name' => '购票趋势', 'uri' => '', 'css' => 'glyphicon-stats'],
            ['parent_id' => 34, 'app_id' => 2, 'name' => '购票盈亏', 'uri' => '', 'css' => 'glyphicon-ysd'],
            ['parent_id' => 0, 'app_id' => 2, 'name' => '财务对账', 'uri' => '', 'css' => 'glyphicon-filter'],
            ['parent_id' => 38, 'app_id' => 2, 'name' => '车站报表', 'uri' => '', 'css' => 'glyphicon-tower'],
            ['parent_id' => 38, 'app_id' => 2, 'name' => '大修厂报表', 'uri' => '', 'css' => 'glyphicon-wrench'],
            ['parent_id' => 38, 'app_id' => 2, 'name' => '加油站报表', 'uri' => '', 'css' => 'glyphicon-cutlery'],
            ['parent_id' => 38, 'app_id' => 2, 'name' => '驾校报表', 'uri' => '', 'css' => 'glyphicon-subtitles'],
            ['parent_id' => 38, 'app_id' => 2, 'name' => '收支报表', 'uri' => '', 'css' => 'glyphicon-subtitles'],
            //
            ['parent_id' => 0, 'app_id' => 1, 'name' => '微信模块', 'uri' => '', 'css' => 'icon-application_view_tile'],
            ['parent_id' => 44, 'app_id' => 1, 'name' => 'Banner管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 45, 'app_id' => 1, 'name' => 'Banner分类', 'uri' => 'wechat.banner.cate', 'css' => 'icon-tag'],
            ['parent_id' => 45, 'app_id' => 1, 'name' => 'Banner列表', 'uri' => 'wechat.banner.banner', 'css' => 'icon-pictures'],
            ['parent_id' => 45, 'app_id' => 1, 'name' => 'Banner新增', 'uri' => 'wechat.banner.banner.add', 'css' => 'icon-picture_add'],

            ['parent_id' => 44, 'app_id' => 1, 'name' => '服务管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 49, 'app_id' => 1, 'name' => '服务分类', 'uri' => 'wechat.service.cate', 'css' => 'icon-plugin_link'],
            ['parent_id' => 49, 'app_id' => 1, 'name' => '服务列表', 'uri' => 'wechat.service.service', 'css' => 'icon-link'],

            //
            ['parent_id' => 44, 'app_id' => 1, 'name' => '公告管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 52, 'app_id' => 1, 'name' => '公告分类', 'uri' => 'wechat.notice.cate', 'css' => 'icon-tag_orange'],
            ['parent_id' => 52, 'app_id' => 1, 'name' => '公告列表', 'uri' => 'wechat.notice.notice', 'css' => 'icon-newspaper'],
            ['parent_id' => 52, 'app_id' => 1, 'name' => '公告新增', 'uri' => 'wechat.notice.notice.add', 'css' => 'icon-newspaper_add'],
            ['parent_id' => 52, 'app_id' => 1, 'name' => '站场列表', 'uri' => 'wechat.station.station', 'css' => 'icon-map'],
            //
            ['parent_id' => 44, 'app_id' => 1, 'name' => '活动管理', 'uri' => '', 'css' => ''],
            ['parent_id' => 57, 'app_id' => 1, 'name' => '活动分类', 'uri' => 'wechat.activity.cate', 'css' => 'icon-plugin'],
            ['parent_id' => 57, 'app_id' => 1, 'name' => '活动列表', 'uri' => 'wechat.activity.activity', 'css' => 'icon-application_view_list'],
            ['parent_id' => 57, 'app_id' => 1, 'name' => '活动新增', 'uri' => 'wechat.activity.activity.add', 'css' => 'icon-plugin_add'],

        ];

        foreach ($apps_auths as $app_auth) {
            factory(App\Http\Models\App\AppAuth::class, 1)->create($app_auth);
        }

        //
        // $apps_groups_extras = [
        //     ['group_id' => 1, 'name' => '区域编号', 'key' => 'zone_code', 'value' => 'yj'],
        //     ['group_id' => 1, 'name' => '区域名称', 'key' => 'zone_name', 'value' => '阳江'],
        //     ['group_id' => 2, 'name' => '区域编号', 'key' => 'zone_code', 'value' => 'yj'],
        //     ['group_id' => 2, 'name' => '区域名称', 'key' => 'zone_name', 'value' => '阳江'],
        //     ['group_id' => 3, 'name' => '区域编号', 'key' => 'zone_code', 'value' => 'yj'],
        //     ['group_id' => 3, 'name' => '区域名称', 'key' => 'zone_name', 'value' => '阳江'],
        // ];
        //应用权限关联信息
        $apps_groups_auths_relations = [
            ['group_id' => 1, 'auth_id' => 1],
            ['group_id' => 1, 'auth_id' => 2],
            ['group_id' => 1, 'auth_id' => 3],
            ['group_id' => 1, 'auth_id' => 4],
            ['group_id' => 1, 'auth_id' => 5],
            ['group_id' => 1, 'auth_id' => 6],
            ['group_id' => 1, 'auth_id' => 7],
            ['group_id' => 1, 'auth_id' => 8],
            ['group_id' => 1, 'auth_id' => 9],
            ['group_id' => 1, 'auth_id' => 10],
            ['group_id' => 1, 'auth_id' => 11],
            ['group_id' => 1, 'auth_id' => 12],
            ['group_id' => 1, 'auth_id' => 13],
            ['group_id' => 1, 'auth_id' => 14],
            ['group_id' => 1, 'auth_id' => 15],
            ['group_id' => 1, 'auth_id' => 16],
            //
            ['group_id' => 1, 'auth_id' => 17],
            ['group_id' => 1, 'auth_id' => 18],
            ['group_id' => 1, 'auth_id' => 19],
            ['group_id' => 1, 'auth_id' => 20],
            ['group_id' => 1, 'auth_id' => 21],
            ['group_id' => 1, 'auth_id' => 22],
            ['group_id' => 1, 'auth_id' => 23],
            //
            ['group_id' => 1, 'auth_id' => 24],
            ['group_id' => 1, 'auth_id' => 25],
            ['group_id' => 1, 'auth_id' => 26],
            ['group_id' => 1, 'auth_id' => 27],
            ['group_id' => 1, 'auth_id' => 28],
            ['group_id' => 1, 'auth_id' => 29],
            ['group_id' => 1, 'auth_id' => 30],
            ['group_id' => 1, 'auth_id' => 31],
            ['group_id' => 1, 'auth_id' => 32],
            ['group_id' => 1, 'auth_id' => 33],
            //
            ['group_id' => 2, 'auth_id' => 14],
            ['group_id' => 2, 'auth_id' => 15],
            ['group_id' => 2, 'auth_id' => 16],
            ['group_id' => 2, 'auth_id' => 17],
            ['group_id' => 2, 'auth_id' => 18],
            ['group_id' => 2, 'auth_id' => 19],
            ['group_id' => 2, 'auth_id' => 20],
            ['group_id' => 2, 'auth_id' => 21],
            ['group_id' => 2, 'auth_id' => 22],
            ['group_id' => 2, 'auth_id' => 23],

            ['group_id' => 2, 'auth_id' => 24],
            ['group_id' => 2, 'auth_id' => 25],
            ['group_id' => 2, 'auth_id' => 26],
            ['group_id' => 2, 'auth_id' => 27],
            ['group_id' => 2, 'auth_id' => 28],
            ['group_id' => 2, 'auth_id' => 29],
            ['group_id' => 2, 'auth_id' => 30],
            ['group_id' => 2, 'auth_id' => 31],
            ['group_id' => 2, 'auth_id' => 32],

            ['group_id' => 3, 'auth_id' => 1],
            ['group_id' => 3, 'auth_id' => 2],
            ['group_id' => 3, 'auth_id' => 3],
            ['group_id' => 3, 'auth_id' => 4],
            ['group_id' => 3, 'auth_id' => 5],
            ['group_id' => 3, 'auth_id' => 6],
            ['group_id' => 3, 'auth_id' => 11],
            ['group_id' => 3, 'auth_id' => 12],
            ['group_id' => 3, 'auth_id' => 13],

            ['group_id' => 3, 'auth_id' => 14],
            ['group_id' => 3, 'auth_id' => 15],
            ['group_id' => 3, 'auth_id' => 16],
            ['group_id' => 3, 'auth_id' => 17],
            ['group_id' => 3, 'auth_id' => 18],
            ['group_id' => 3, 'auth_id' => 19],
            ['group_id' => 3, 'auth_id' => 20],
            ['group_id' => 3, 'auth_id' => 21],
            ['group_id' => 3, 'auth_id' => 22],
            ['group_id' => 3, 'auth_id' => 23],

            ['group_id' => 4, 'auth_id' => 1],
            ['group_id' => 4, 'auth_id' => 2],
            ['group_id' => 4, 'auth_id' => 3],
            ['group_id' => 4, 'auth_id' => 4],
            ['group_id' => 4, 'auth_id' => 5],
            ['group_id' => 4, 'auth_id' => 6],
            ['group_id' => 4, 'auth_id' => 7],
            ['group_id' => 4, 'auth_id' => 8],
            ['group_id' => 4, 'auth_id' => 9],
            ['group_id' => 4, 'auth_id' => 10],
            ['group_id' => 4, 'auth_id' => 11],
            ['group_id' => 4, 'auth_id' => 12],
            ['group_id' => 4, 'auth_id' => 13],
            ['group_id' => 4, 'auth_id' => 14],
            ['group_id' => 4, 'auth_id' => 15],
            ['group_id' => 4, 'auth_id' => 16],

            ['group_id' => 4, 'auth_id' => 24],
            ['group_id' => 4, 'auth_id' => 25],
            ['group_id' => 4, 'auth_id' => 26],
            ['group_id' => 4, 'auth_id' => 27],
            ['group_id' => 4, 'auth_id' => 28],
            ['group_id' => 4, 'auth_id' => 29],
            ['group_id' => 4, 'auth_id' => 30],
            ['group_id' => 4, 'auth_id' => 31],
            ['group_id' => 4, 'auth_id' => 32],

            //
            ['group_id' => 7, 'auth_id' => 34],
            ['group_id' => 7, 'auth_id' => 35],
            ['group_id' => 7, 'auth_id' => 36],
            ['group_id' => 7, 'auth_id' => 37],
            ['group_id' => 7, 'auth_id' => 38],

            ['group_id' => 7, 'auth_id' => 39],
            ['group_id' => 7, 'auth_id' => 40],
            ['group_id' => 7, 'auth_id' => 41],
            ['group_id' => 7, 'auth_id' => 42],
            ['group_id' => 7, 'auth_id' => 43],

            ['group_id' => 8, 'auth_id' => 34],
            ['group_id' => 8, 'auth_id' => 35],
            ['group_id' => 8, 'auth_id' => 36],
            ['group_id' => 8, 'auth_id' => 37],
            ['group_id' => 8, 'auth_id' => 38],

            ['group_id' => 9, 'auth_id' => 39],
            ['group_id' => 9, 'auth_id' => 40],
            ['group_id' => 9, 'auth_id' => 41],
            ['group_id' => 9, 'auth_id' => 42],
            ['group_id' => 9, 'auth_id' => 43],

            ['group_id' => 13, 'auth_id' => 44],
            ['group_id' => 13, 'auth_id' => 45],
            ['group_id' => 13, 'auth_id' => 46],
            ['group_id' => 13, 'auth_id' => 47],
            ['group_id' => 13, 'auth_id' => 48],
            ['group_id' => 13, 'auth_id' => 49],
            ['group_id' => 13, 'auth_id' => 50],
            ['group_id' => 13, 'auth_id' => 51],
            ['group_id' => 13, 'auth_id' => 52],
            ['group_id' => 13, 'auth_id' => 53],
            ['group_id' => 13, 'auth_id' => 54],
            ['group_id' => 13, 'auth_id' => 55],
            ['group_id' => 13, 'auth_id' => 56],
            ['group_id' => 13, 'auth_id' => 57],
            ['group_id' => 13, 'auth_id' => 58],
            ['group_id' => 13, 'auth_id' => 59],
            ['group_id' => 13, 'auth_id' => 60],

        ];

        foreach ($apps_groups_auths_relations as $app_group_auth_relation) {
            factory(App\Http\Models\App\AppGroupAuthRelation::class, 1)->create($app_group_auth_relation);
        }

        //员工信息
        $staffs = [
            ['name' => '佘经理', 'account' => 'shejicun', 'mobile' => '15915750215', 'email' => 'cs09bmeek@qq.com'],
            ['name' => '俭哥', 'account' => 'linzhijian', 'mobile' => '15915750216', 'email' => 'cs09bmeek@126.com'],
            ['name' => '张三', 'account' => 'zhangsan', 'mobile' => '15915750217', 'email' => 'cs09bmeek@139.com'],
            ['name' => '李四', 'account' => 'lisi', 'mobile' => '15915750218', 'email' => 'cs09bmeek@163.com'],
            ['name' => '李大肥', 'account' => 'ldf', 'mobile' => '18825110129', 'email' => '18825110126@hotmial.com'],
        ];

        foreach ($staffs as $staff) {
            factory(App\Http\Models\Staff\Staff::class, 1)->create($staff);
        }
        //员工应用关联信息
        $staffs_apps_relations = [
            ['staff_id' => 1, 'app_id' => 1],
            ['staff_id' => 2, 'app_id' => 1],
            ['staff_id' => 3, 'app_id' => 1],
            ['staff_id' => 4, 'app_id' => 1],
            ['staff_id' => 1, 'app_id' => 2],
            ['staff_id' => 2, 'app_id' => 2],
            ['staff_id' => 3, 'app_id' => 2],
            ['staff_id' => 4, 'app_id' => 2],
            ['staff_id' => 5, 'app_id' => 1],
        ];

        foreach ($staffs_apps_relations as $staff_app_relation) {
            factory(App\Http\Models\Staff\StaffAppRelation::class, 1)->create($staff_app_relation);
        }

        //员工关联应用关联组信息
        $staffs_apps_groups_relations = [
            ['staff_id' => 1, 'app_id' => 1, 'group_id' => 1],
            ['staff_id' => 2, 'app_id' => 1, 'group_id' => 2],
            ['staff_id' => 3, 'app_id' => 1, 'group_id' => 3],
            ['staff_id' => 4, 'app_id' => 1, 'group_id' => 4],
            ['staff_id' => 5, 'app_id' => 1, 'group_id' => 13],
            ['staff_id' => 1, 'app_id' => 2, 'group_id' => 7],
            ['staff_id' => 2, 'app_id' => 2, 'group_id' => 8],
            ['staff_id' => 3, 'app_id' => 2, 'group_id' => 9],
            ['staff_id' => 4, 'app_id' => 2, 'group_id' => 10],
        ];

        foreach ($staffs_apps_groups_relations as $staff_app_group_relation) {
            factory(App\Http\Models\Staff\StaffAppGroupRelation::class, 1)->create($staff_app_group_relation);
        }
        //员工部门信息
        $staffs_depts = [
            ['name' => '电脑信息部', 'desc' => "hello world !", 'telephone' => "0662-333444", 'leader' => "佘经理"],
        ];

        foreach ($staffs_depts as $staff_dept) {
            factory(App\Http\Models\Staff\StaffDept::class, 1)->create($staff_dept);
        }
        //员工岗位信息
        $staffs_posts = [
            ['name' => '经理', 'desc' => "hello world !", "code" => "JL"],
            ['name' => '副经理', 'desc' => "hello world !", "code" => "FJL"],
        ];

        foreach ($staffs_posts as $staff_post) {
            factory(App\Http\Models\Staff\StaffPost::class, 1)->create($staff_post);
        }

    }
}
